package com.ungs.form;

import java.awt.BorderLayout;

import javax.swing.ButtonGroup;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.border.EmptyBorder;
import javax.swing.border.TitledBorder;

import com.ungs.utils.Constantes;

public class ChangeLAF extends JDialog {
	private static final long serialVersionUID = 1L;
	private final JPanel contentPanel = new JPanel();

	public ChangeLAF(JFrame parent) {
		super(parent, true);
		setTitle("Estilos");
		setResizable(false);
		setBounds(100, 100, 274, 246);
		getContentPane().setLayout(new BorderLayout());
		contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
		getContentPane().add(contentPanel, BorderLayout.CENTER);
		contentPanel.setLayout(null);

		JPanel panel = new JPanel();
		panel.setBorder(new TitledBorder(null, "Estilo", TitledBorder.LEADING,
				TitledBorder.TOP, null, null));
		panel.setBounds(25, 11, 212, 189);
		contentPanel.add(panel);
		panel.setLayout(null);

		JRadioButton rdbtNimbus = new JRadioButton("Nimbus");
		rdbtNimbus.setBounds(22, 32, 109, 23);
		rdbtNimbus.setActionCommand(Constantes.LAF_NIMBUS);
		panel.add(rdbtNimbus);

		JRadioButton rdbtnWindows = new JRadioButton("Windows");
		rdbtnWindows.setBounds(22, 58, 109, 23);
		rdbtnWindows.setActionCommand(Constantes.LAF_WINDOWS);
		panel.add(rdbtnWindows);

		JRadioButton rdbtnWindowsClassic = new JRadioButton("Windows Classic");
		rdbtnWindowsClassic.setBounds(22, 84, 148, 23);
		rdbtnWindowsClassic.setActionCommand(Constantes.LAF_WINDOWSCLASSIC);
		panel.add(rdbtnWindowsClassic);

		JRadioButton rdbtnMetal = new JRadioButton("Metal");
		rdbtnMetal.setBounds(22, 110, 109, 23);
		rdbtnMetal.setActionCommand(Constantes.LAF_METAL);
		panel.add(rdbtnMetal);

		JRadioButton rdbtnMotif = new JRadioButton("Motif");
		rdbtnMotif.setBounds(22, 136, 109, 23);
		rdbtnMotif.setActionCommand(Constantes.LAF_MOTIF);
		panel.add(rdbtnMotif);
		// Group the radio buttons.
		ButtonGroup group = new ButtonGroup();
		group.add(rdbtnMetal);
		group.add(rdbtnMotif);
		group.add(rdbtnWindows);
		group.add(rdbtnWindowsClassic);
		group.add(rdbtNimbus);

		RadioListener myListener = new RadioListener();
		rdbtNimbus.addActionListener(myListener);
		rdbtnMetal.addActionListener(myListener);
		rdbtnMotif.addActionListener(myListener);
		rdbtnWindows.addActionListener(myListener);
		rdbtnWindowsClassic.addActionListener(myListener);
		this.repaint();

	}
}